package user

import (
	"chaowan/data_source"
	"chaowan/models"
	"github.com/gin-gonic/gin"
	"net/http"
)

func Kefu(ctx *gin.Context) {

	var kefu models.Kefu
	data_source.Db.Where("id = 1").First(&kefu)

	ctx.JSON(http.StatusOK, gin.H{
		"code":    0,
		"error":   0,
		"success": 200,
		"data":    kefu,
		"msg":     "ok",
	})
	return
}
func Banners(ctx *gin.Context) {

	var users []models.Banner
	data_source.Db.Find(&users)
	ctx.JSON(http.StatusOK, gin.H{
		"code":    0,
		"error":   0,
		"success": 200,
		"data":    users,
		"msg":     "ok",
	})
	return
}
func Bannerinfo(ctx *gin.Context) {
	request := YuyandayBody{}
	ctx.ShouldBind(&request)
	id := request.ID
	var users models.Banner
	data_source.Db.Where("id = ?", id).First(&users)
	ctx.JSON(http.StatusOK, gin.H{
		"code":    0,
		"error":   0,
		"success": 200,
		"data":    users,
		"msg":     "ok",
	})
	return
}
